package com.ttbj.controller.driver;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ttbj.product.api.DriverFacade;
import com.ttbj.product.api.WaybillFacade;
import com.ttbj.product.bean.dto.DriverDto;
import com.ttbj.product.bean.dto.ViewData;
import com.ttbj.product.bean.dto.WaybillDto;
import com.ttbj.util.ResultUtil;
import com.ttbj.util.ViewModelUtil;

/**
 * 司机接口
 * 根据订单id查询司机相关信息
 * @author Mdivh
 *
 */
@Controller
@RequestMapping("/applet/driver")
public class DriverController {

	@Autowired
	private WaybillFacade waybillFacade = null;
	
	
	
	/**
	 * 根据订单id查询订单所属的司机信息
	 * @param orderId
	 * @param openId
	 * @throws Exception
	 */
	@RequestMapping(value = "/all.do", method = RequestMethod.POST)
	@ResponseBody
	public  ViewData driverAll(HttpServletRequest request, HttpServletResponse response,Long orderId,String openId) throws Exception{
		List<DriverDto> allDriver = waybillFacade.allDriver(orderId);
		return ViewModelUtil.buildSuccessPage("成功", allDriver, allDriver.size());
	}
	
	
	
}
